#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main() {
    double price;
    int month;
    int day;
    int flag;
    scanf("%lf %d %d %d", &price, &month, &day, &flag);
    if (month == 11 && day == 11) {
        price *= 0.7;
        if (flag == 1)
            price -= 50;
    }
    else if (month == 12 && day == 12) {
        price *= 0.8;
        if (flag == 1)
            price -= 50;
    }
    if (price > 0)
        printf("%.2lf", price);
    else
        printf("0.00");
    return 0;
}